package com.trust.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.trust.entity.FarmSeedConsumable;
import com.trust.mapper.FarmSeedConsumableMapper;
import com.trust.service.FarmSeedConsumableService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FarmSeedConsumableServiceImpl extends ServiceImpl<FarmSeedConsumableMapper, FarmSeedConsumable> implements FarmSeedConsumableService {
    @Resource
    private FarmSeedConsumableMapper mapper;

    @Override
    public void removeByFarmSeedId(Integer farmSeedId) {
        LambdaQueryWrapper<FarmSeedConsumable> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(FarmSeedConsumable::getPlantId, farmSeedId);
        this.remove(wrapper);
    }


    @Override
    public List<FarmSeedConsumable> getByFarmSeedId(Integer farmSeedId) {
        LambdaQueryWrapper<FarmSeedConsumable> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(FarmSeedConsumable::getPlantId, farmSeedId);
        return this.list(wrapper);
    }
}
